<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!--
    	作者：845510257@qq.com
    	时间：2017-10-25
    	描述：title部分，公共js,公共css和jstl标签库
    -->
<%@include file="/source/page/parts/title.jsp"%>
<!-- 	下面引入本页面单独引入的资源 -->





<link rel="stylesheet" href="/GDZjiajiaowang/source/css/studentlist.css" />
<link rel="stylesheet" href="/GDZjiajiaowang/source/css/indexStyle.css"
	type="text/css" />

<script type="text/javascript"
	src="/GDZjiajiaowang/source/js/studentlist.js"></script>
<script type="text/javascript">
	var subjectName = "";
	var addressName = "";
	var studentSex = "";
	var gradeName = "";
	var workType = "";

	var pageNo = 1;
	var totalPageCount = 1;
	$(function() {
		$(".teacher_list_div")
				.click(
						function() {
							location.href = "/GDZjiajiaowang/StudentInfoBeanServlet?studentId="
									+ $(this).attr("id");

						});

		//进入页面后执行ajax
		showStudentList();
		//筛选处理
		$("#subject_div ul li").click(function() {
			$(this).addClass("choosedli").siblings().removeClass("choosedli");
			if ("subject_ul" == $(this).parent().attr("class")) {
				subjectName = $(this).text();
				if (subjectName == "不限") {
					subjectName = "";
				}
			} else if ("area_ul" == $(this).parent().attr("class")) {
				addressName = $(this).text();
				if (addressName == "不限") {
					addressName = "";
				}
			} else if ("sex_ul" == $(this).parent().attr("class")) {
				studentSex = $(this).text();
				if (studentSex == "不限") {
					studentSex = "";
				}
			} else if ("grade_ul" == $(this).parent().attr("class")) {
				gradeName = $(this).text();
				if (gradeName == "不限") {
					gradeName = "";
				}
				if (gradeName == "小学") {
					gradeName = "年级";
				}
				if (gradeName == "初中") {
					gradeName = "初";
				}
				if (gradeName == "高中") {
					gradeName = "高";
				}
			} else if ("workType_ul" == $(this).parent().attr("class")) {
				workType = $(this).text();
				if (workType == "不限") {
					workType = "";
				}
			}
			pageNo = 1;
			showStudentList();
		});
		//分页处理
		// 		<span id="firsrPage">首页</span> <span id="prePage">上一页</span> <span>当前第</span><span id="pageNo">5</span>
		// 				<span id="nextPage">下一页</span><span id="lastPage">末页</span>
		// 				<span>共</span><span id="totalPageCount">1</span><span>页</span>
		// 				<span>共</span><span id="totalStudentCount">1</span><span>条</span>
		// 				<span>跳转到第</span><input value="" name="pageNo"><span>页</span>
		// 				<button id="go">Go</button>
		$("#firsrPage").click(function() {
			if (pageNo == 1) {
				alert("已经是第一页了！");
				return false;

			}
			pageNo = 1;
			showStudentList();
		})
		$("#prePage").click(function() {
			pageNo = parseInt(pageNo) - 1;
			if (pageNo == 0) {
				alert("已经是第一页了！");
				pageNo = 1;
				return false;

			}
			showStudentList();
		})
		$("#nextPage").click(function() {
			pageNo = parseInt(pageNo) + 1;
			if (pageNo > totalPageCount) {
				alert("已经是最后一页了！");
				pageNo = totalPageCount;
				return false;

			}
			showStudentList();
		})
		$("#lastPage").click(function() {
			if (pageNo == totalPageCount) {
				alert("已经是最后一页了！");
				return false;

			}
			pageNo = totalPageCount;
			showStudentList();
		})
		$("#go").click(function() {
			pageNo = $("input[name=pageNo]").val();
			showStudentList();
		})
		$("input[name=pageNo]").change(function() {
			if (parseInt($(this).val()) > totalPageCount) {
				$(this).val(totalPageCount);
			}

		})
	})

	function showStudentList() {
		var jsondate = {
			"subjectName" : subjectName,
			"addressName" : addressName,
			"studentSex" : studentSex,
			"gradeName" : gradeName,
			"pageNo" : pageNo,
			"workType" : workType
		};
		$.ajax({
			type : "post",
			url : "/GDZjiajiaowang/StudentListPageBeanServlet",
			data : jsondate,
			dataType : "json",
			contentType : "application/x-www-form-urlencoded; charset=utf-8",
			success : function(data) {
				var students = data.students;
				if (null != students && students.length != 0) {
					// 					<!--
					// 					如果学生列表非空，为学生列表赋值 
					// 					-->
					var studentListDiv = $(".student_list_div");
					for (var i = 0; i < students.length; i++) {
						var student = students[i];
						var studentDiv = studentListDiv.find("div:eq(" + i
								+ ")");
						studentDiv.attr("id", student.studentId);
						studentDiv.show();
						studentDiv.find(" .head_img").attr("src", student.src);
						studentDiv.find(" .studentName").text(
								student.studentName);
						studentDiv.find(" .studentGradeName").text(
								student.gradeName);
						studentDiv.find(" .studentSex")
								.text(student.studentSex);
						studentDiv.find(" .studentSubjectName").text(
								student.subjectName);
						studentDiv.find(" .studentDesc").text(
								student.studentDesc);
					}
					// 					隐藏多余学生列表
					if (students.length < 11) {
						var hideNo = students.length - 1;
						var studentDiv = studentListDiv.find("div:gt(" + hideNo
								+ ")");
						studentDiv.hide();
					}

					// 					分页处理
					$("#pageNo").text(data.pageNo);
					$("#totalPageCount").text(data.totalPageCount);
					$("#totalStudentCount").text(data.totalStudentCount);
					$("input[name=pageNo]").val(data.pageNo);

					//为全局变量pageNo赋值
					pageNo = data.pageNo;
					totalPageCount = data.totalPageCount;

				} else {
					alert("没有数据");
					$(".student_list_div").children().hide();
					$("#pageNo").text(1);
					$("#totalPageCount").text(0);
					$("#totalStudentCount").text(0);
					$("input[name=pageNo]").val(1);
				}
			}
		})
	}
</script>
</head>
<!--
     	作者：GGVVR
     	时间：2017-11-08
     	描述：
     -->
<body>
	<!--
            	作者：GGVVR
            	时间：2017-10-25
            	描述：header部分（head_top、head_middle、head_botton）
            -->
	<%@include file="/source/page/parts/header.jsp"%>


	<!--
    	作者：offline
    	时间：2017-11-08
    	描述：主体部分
    -->
	<section>
	<div class="main_line">

		<div class="main_line_one">
			<p>
				<span>GDZ家教网</span> <span>></span> <span>学生信息列表</span>
			</p>
		</div>
		<div class="main_line_two">
			<p>
				<span>|</span><span>信息简介</span>
			</p>


		</div>
		<div class="main_line_three">
			<div class="clearfix" id="subject_div">
				<span>学习学科</span>
				<ul class="subject_ul">
					<li class="choosedli">不限</li>
					<li>语文</li>
					<li>数学</li>
					<li>英语</li>
					<li>物理</li>
					<li>生物</li>
					<li>历史</li>
					<li>政治</li>
					<li>地理</li>
					<li>化学</li>
				</ul>
			</div>
			<div class="clearfix" id="subject_div">
				<span>所在区域</span>
				<ul class="area_ul">
					<li class="choosedli">不限</li>
					<li>雨花台区</li>
					<li>浦口区</li>
					<li>江宁区</li>
					<li>六合区</li>
					<li>栖霞区</li>
					<li>下关区</li>
					<li>鼓楼区</li>
					<li>玄武区</li>
					<li>白下区</li>
				</ul>
			</div>
			<div class="clearfix" id="subject_div">
				<span>性别要求</span>
				<ul class="sex_ul">
					<li class="choosedli">不限</li>
					<li>男</li>
					<li>女</li>
				</ul>
			</div>

			<div class="clearfix" id="subject_div">
				<span>学生年级</span>
				<ul class="grade_ul">
					<li class="choosedli">不限</li>
					<li>小学</li>
					<li>初中</li>
					<li>高中</li>
					<li>一年级</li>
					<li>二年级</li>
					<li>三年级</li>
					<li>四年级</li>
					<li>五年级</li>
					<li>六年级</li>
					<li>初一</li>
					<li>初二</li>
					<li>初三</li>
					<li>高一</li>
					<li>高二</li>
					<li>高三</li>
				</ul>
			</div>
			<div class="clearfix" id="subject_div">
				<span>辅导方式</span>
				<ul class="workType_ul">
					<li class="choosedli">不限</li>
					<li>上门辅导</li>
					<li>补习班辅导</li>
				</ul>
			</div>
		</div>
		<div class="main_line_four clearfix student_list_div">
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
			<div class="teacher_list_div">
				<img src="/GDZjiajiaowang/source/img/11.png" class="head_img" />
				<p>
					<span class="studentName">张三</span><img src="" alt="" />
				</p>
				<p>
					<span class="studentGradeName"> 高三</span>/<span class="studentSex">男</span>/<span
						class="studentSubjectName">数学</span>
				</p>
				<p class="studentDesc">在校期间，认真学习，完成学习任务(部分细节把握不好)</p>
			</div>
		</div>
		<div class="main_line_five">
			<div class="main_line_five_inside">
				<span id="firsrPage">首页</span> <span id="prePage">上一页</span> <span>当前第</span><span
					id="pageNo">5</span> <span id="nextPage">下一页</span><span
					id="lastPage">末页</span> <span>共</span><span id="totalPageCount">1</span><span>页</span>
				<span>共</span><span id="totalStudentCount">1</span><span>条</span> <span>跳转到第</span>
				<input type="number" min=1 value="" name="pageNo"><span>页</span>
				<button id="go">Go</button>


			</div>
		</div>
	</div>
	</section>
<!--
    	作者：845510257@qq.com
    	时间：2017-10-25
    	描述：footer部分，
    -->
<%@include file="/source/page/parts/footer.jsp"%>






	<!--
    	作者：杨辉
    	时间：2017-10-25
    	描述：登录弹窗，
    -->
	<%@include file="/source/page/parts/loginMini.jsp"%>
	
	
	<!--
    	作者：吴金山
    	时间：2017-10-25
    	描述：登录js
    -->
<%@include file="/source/page/parts/login.jsp"%>



</body>
</html>
